﻿/*公告提示*/
var s4g=0;
var guoqing;
$("#m1").bind("touchmove",function(e){e.preventDefault();return false})
/*点击小球跳到推送页面*/
function clickball() {
	clickCount(1);
	bc=0;	
	$("#pagepush").css( {"width":"100%","height":"100%"});
	$("#flowwindows").show().removeClass("pagehide").addClass("pageshow");
	$("#flowball").removeClass("ballshow").addClass("ballhide");
			  	clearTimeout(chz);
               jus=0;
	           $("#flowball" ).removeClass("biandan");
	
};
/*关闭推送页面返回小球*/
function returnball() {
	clickCount(2);
	bc=1;
    $("#pagepush").css( {"width":"","height":""});
	$("#flowball").removeClass("ballhide").addClass("ballshow");
	$("#flowwindows").removeClass("pageshow").addClass("pagehide");
	$("#flowball" ).removeClass("biandan");
	timedCount();
}
/*页面下方导航显示各页面内容*/
var slide=0;/*滑动设置*/
function nav(p) {
	var tab = p;
	if (tab == 1) {	
	    $(".nav li").removeClass("active");
		$("#nav1").addClass("active");
		$("#nav11").removeClass("myflow1").addClass("myflow2");
		$("#nav21").removeClass("addflow2").addClass("addflow1");
		$("#nav31").removeClass("find2").addClass("find1");
		$(".contentpage").hide();
		$("#content"+tab).show();
		$("#flowsmeal2").hide();
		$("#flowsmeal1").show();
	} else if (tab == 2) {
		if($("#content21").is(":hidden")){clickCount(4);}else{clickCount(7);}
		$(".nav li").removeClass("active");
		$("#nav2").addClass("active");
        $("#nav11").removeClass("myflow2").addClass("myflow1");
		$("#nav21").removeClass("addflow1").addClass("addflow2");
		$("#nav31").removeClass("find2").addClass("find1");
		$(".contentpage").hide();
		$("#content"+tab).show();
		
		 if( slide==0){
		 jQuery(".slideBox").slide({ mainCell:".bd ul",effect:"left",autoPlay:false} );}
		 slide=1;
	} else if (tab == 3) {
		changeimage();
		$(".nav li").removeClass("active");
		$("#nav3").addClass("active");
        $("#nav11").removeClass("myflow2").addClass("myflow1");
		$("#nav21").removeClass("addflow2").addClass("addflow1");
		$("#nav31").removeClass("find1").addClass("find2");
		$(".contentpage").hide();
		$("#content"+tab).show();
	} 
    else if (tab == 4) {
		clickCount(8);
		$(".contentpage").hide();
		$("#content"+tab).show();
	} 
};
/*设置页面推送时间选择事件*/
function pushtime(p) {
	if (p == 1) {
		$(".tick2").removeClass("tick2").addClass("tick");
		$("#tick"+p).addClass("tick2");
		$("#tt").val(3);
	   } else if (p == 2) {
		$(".tick2").removeClass("tick2").addClass("tick");
		$("#tick"+p).addClass("tick2");
		$("#tt").val(2);
       } else if (p == 3) {
        $(".tick2").removeClass("tick2").addClass("tick");
		$("#tick"+p).addClass("tick2");
		$("#tt").val(1);
			} else 
				if (p == 4) {
$(".tick2").removeClass("tick2").addClass("tick");
		$("#tick"+p).addClass("tick2");
		$("#tt").val(0);
				}

};
/*意见反馈事件*/
function countChar(textareaName,spanName){
	document.getElementById(spanName).innerHTML=100-document.getElementById(textareaName).value.length;maxlimit=99;
	if(document.getElementById(textareaName).value.length>maxlimit)
	{document.getElementById(textareaName).value=document.getElementById(textareaName).value.substring(0,maxlimit)
	}
	};
function Trim1(s) {
	return s.replace(/(^\s*)|(\s*$)/g, "");
}
function opinion() {
	var var1 = document.getElementById("textarea");
	if (Trim1(var1.value) != "") {
		$("#counter").text("100");
		$("#suc").show();
		$("#suc").delay(2500).fadeOut();
		var turl=path+"xxfeedback.do?command=1&mdn="+mdn+"&content="+encodeURIComponent($("#textarea").val());
		
		$.ajax( {
			url : turl,
			dataType : "jsonp",
			jsonp : "callback1",
			async : false,
			cache : false
		});
		var1.value="";
	} else if (Trim1(var1.value) == "") {
		$("#def").show();
		$("#def").delay(2500).fadeOut();
	}
}
function worddel(){
	var var1 = document.getElementById("textarea");
	var1.value="";
	$("#counter").text("100");
	}
/*购买流量页滑动*/

 
 /*小球拖拽功能
var xe1 = 0;
var ye1 = 0;
var startX = 0;
var startY = 0;
var llbtn_left = 0;
var llbtn_bottom = 0;
var t = false;
var tap = false;
var winh =$(document).height()-78;
var winw = $(document).width() - 78;
$("#flowball").bind("touchcancel",function(e){t=false;tap=false});
$("#flowball").bind("touchend",function(e){
	    if(xe1>0&&xe1<winw/2&&ye1!=0){
		$("#flowball").css("left","0");xe1=0}
		else if(xe1>winw/2&&xe1<winw&&ye1!=0){$("#flowball").css("left",winw);xe1=winw} 
		if(xe1==llbtn_left&&ye1==llbtn_bottom){ clickball();}
		llbtn_left=xe1;
		llbtn_bottom=ye1;
		t=false;
		tap=false;});

$("#flowball").bind("touchstart",function(e){
	e.preventDefault();
	t=true;
	tap=true;
	$("#flowball").removeClass("shudu");
	startX=e.originalEvent.touches[0].pageX;
	startY=e.originalEvent.touches[0].pageY;
	return false});

$("#flowball").bind("touchmove",function(e){if(t){
	e.preventDefault();
	tap=false;
	$("#flowball").addClass("shudu");
	xe1=e.originalEvent.touches[0].pageX-startX+llbtn_left;
	ye1=llbtn_bottom-e.originalEvent.touches[0].pageY+startY;
	    if(xe1>=0&&xe1<=winw&&ye1>=0&&ye1<=winh)
		{$("#flowball").css({"left":xe1,"bottom":ye1});}
		else if(xe1<0&&xe1<=winw&&ye1<0&&ye1<=winh)
		{$("#flowball").css({"left":0,"bottom":0});xe1=0;ye1=0;}
		else if(xe1>=0&&xe1>winw&&ye1>=0&&ye1>winh)
		{$("#flowball").css({"left":winw,"bottom":winh});xe1=winw;ye1=winh;}
		else if(xe1>=0&&xe1>winw&&ye1<0&&ye1<=winh)
		{$("#flowball").css({"left":winw,"bottom":0});xe1=winw;ye1=0;}
		else if(xe1>=0&&xe1>winw&&ye1<0&&ye1<=winh)
		{$("#flowball").css({"left":0,"bottom":winh});xe1=0;ye1=winh;}
		else if(xe1<0&&xe1<=winw&&ye1>=0&&ye1<=winh)
		{$("#flowball").css({"left":0,"bottom":ye1});xe1=0;}
		else if(xe1>=0&&xe1>winw&&ye1>=0&&ye1<=winh)
		{$("#flowball").css({"left":winw,"bottom":ye1});xe1=winw;}
		else if(xe1>=0&&xe1<=winw&&ye1<0&&ye1<=winh)
		{$("#flowball").css({"left":xe1,"bottom":0});ye1=0;}
		else if(xe1>=0&&xe1<=winw&&ye1>=0&&ye1>winh)
		{$("#flowball").css({"left":xe1,"bottom":winh});ye1=winh;}
		return false}});
		*/		
function orderbuy(code){
	clickCount(5);
	nav(2);
	$("#succimg").html('<img src="'+imgs+'/images/puff.svg" width="100%">');
	$("#msg").text("系统请求中...");
	$("#content1").hide();
	$("#content2").hide();
	$("#content21").show();
	$("#checkbox1")[0].checked=true;
	$("#buycode").val(code);
	if(code=="8111"){
$("#package").html('<div class="p1"> <div><span class="fontgreen">5</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;30</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购5元一次性流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>');
	}else if(code=="8112"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;60</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购10元一次性流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8113"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">20</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;150</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购20元一次性流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8114"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">30</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;250</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购30元一次性流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8115"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">50</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;500</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购50元一次性流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8116"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;100</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购10元流量加餐包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8117"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">30</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;500</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购30元流量加餐包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8118"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">100</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;3</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购100元流量加餐包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">仅限当月&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8121"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">5</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;30</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购5元包月流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8122"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;100</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购10元包月流量包，送100M本地流量，赠送6个月！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8123"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">20</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;300</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购20元包月流量包，送300M本地流量，赠送6个月！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8124"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">30</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;500</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购30元包月流量包，送500M本地流量，赠送6个月！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8125"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">50</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;1</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购50元包月流量包，送1G本地流量，赠送6个月！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8126"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">70</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;2</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购70元包月流量包，送2G本地流量，赠送6个月！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}else if(code=="8127"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">100</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;3</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购100元包月流量包，送3G本地流量，赠送6个月！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国</div>')
	}
	else if(code=="8131"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;1</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购10元夜间流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内夜间</div>')
	}else if(code=="8132"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">20</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;3</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购20元夜间流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内夜间</div>')
	}else if(code=="8141"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">2</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;100</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购2元包日流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">24小时&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">本地</div>')
	}else if(code=="8142"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">5</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;500</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购5元包日流量包！</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">24小时&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">本地</div>')
	}else if(code=="8143"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">30</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;500</span>M</div></div><div class="p2">尊敬的客户，点击“办理”，您将订购30元本地周日畅爽包，送周日专属4G本地流量</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">全国&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">本地4GB</div></div>')
	}
	/*else if(code=="8152"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;800</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购 10元省内七天假日包，假日特享，7*24小时内有效</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">7*24小时&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内&nbsp;&nbsp;</div></div>')
	}else if(code=="8153"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">20</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;2</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购 20元省内七天假日包，假日特享，7*24小时内有效</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">7*24小时&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内&nbsp;&nbsp;</div></div>')
	}else if(code=="8154"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;1</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购 10元省内三天假日包，假日特享，3*24小时内有效</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">3*24小时&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内&nbsp;&nbsp;</div></div>')
	}else if(code=="8155"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">20</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;500</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购 20元国内七天假日包，假日特享，7*24小时内有效</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">7*24小时&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">国内&nbsp;&nbsp;</div></div>')
	}*/
	else if(code=="8161"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;100</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购 10元4G畅聊流量包，送100分钟国内语音</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内&nbsp;&nbsp;</div></div>')
	}else if(code=="8162"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">50</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;1000</span>M</div></div><div class="p2">尊敬的客户，点击“办理”您将订购 50元4G畅聊流量包，送100分钟国内语音</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">按月续订&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内&nbsp;&nbsp;</div></div>')
	}else if(code=="8154"){
		$("#package").html('<div class="p1"> <div><span class="fontgreen">10</span>元&nbsp;<img src="'+imgs+'/images/icon6.png" height="10"><span class="fontorange">&nbsp;1</span>G</div></div><div class="p2">尊敬的客户，点击“办理”您将订购 10元省内三天假日包，限量优惠，每天限购9999个</div><div class="p3"><img src="'+imgs+'/images/dg3.png" height="15">3*24小时&nbsp;&nbsp;<img src="'+imgs+'/images/dg3.png" height="15">省内&nbsp;&nbsp;</div></div>')
	}	
	if(code.charAt(2)=="1"){$("#warmcontent").html('<p>①加餐包使用后需再次购买，不自动续费；仅当月有效，过期作废，次月不自动续包。不享受1-10日首订5折优惠。</p><p>② <span style=" font-size:1.3em; font-weight:bold; color:#f80300;">每周三成功订购加餐包，享周三加送流量特惠！</span> 加餐包办理成功后立即生效，加送的流量24小时之内生效。加餐包所含流量和加送流量仅当月有效，次月自动失效（加送特惠详情：10元包加送30MB全国流量，30元包加送60MB全国流量，100元包加送500MB本地流量）</p><p>③流量超出后由号码本身套餐或者标准资费来收取。6分卡（0元保底）用户和天翼副号不参与此次活动！详询当地10000号。</p>')}
	else if(code.charAt(2)=="2"){$("#warmcontent").html('<p>①即日起至10月31日期间，“流量送半年”的优惠活动，每个福建天翼号码仅可参与一次。</p><p>②活动期间成功订购任一档次包月包的新用户享包月包 “买一送一”特权，赠送订购包对应的全月本地流量；符合活动要求的老用户可直接领取正在使用的包月包对应的全月本地流量；</p><p>③参与“流量送半年”优惠活动的用户，获赠的本地流量包，赠送6个月（含订购当月）；在领取赠送的流量包前若变更或退订当前所订包月流量包，将无法领取赠送的流量；领取成功后3个月内不能变更及退订当前所订包月流量包。</p><p>④用户获赠的流量包受理成功后立即生效，次月失效；获赠的流量包不予兑换现金，不设退换货服务。</p><p>⑤新版4G包月流量包订购当月费用由按使用量折算调整为按日折算。例：用户6月16日订购10元100M包月流量包，当月剩余15天，则当月费用为10*(15/30)=5元，包内流量为100*(15/30)=50M，次月自动续包。</p><p>⑥新用户特权：成功首订任意包月包享5折特惠，次月可获赠订购流量包金额50%的话费。当月拆除次月不送，一个电信号码仅限一次，不可重复参与（已在电信营业厅客户端、支付宝服务窗中国电信平台上享受首订5折的用户不再次享受）。</p><p>⑦如需变更，须先退订原有流量包，再订购即可。退订原包次月生效，新定包立即生效。</p><p>⑧原包月流量包用户升级为4G包月流量包，变更当月新包可享受减免优惠，新装当月不收取费用；在4G包月流量包不同档次之间进行变更，新装当月不享受减免优惠，新装包费用按天收取。</p><p>⑨4G包月流量包不参与套餐分享，副卡不可分享主卡订购的4G包月流量包内流量，副卡可单独订购4G包月流量包。</p><p>⑩4G包月流量包所含流量为国内流量，可用于4G、3G、2G上网方式，限在中国大陆境内（不含港澳台地区）使用，不含WiFi上网。流量超出后由号码本身套餐或者标准资费来收取。天翼副号不参与此次活动！详询当地10000号。</p>')}
	else if(code.charAt(2)=="3"){$("#warmcontent").html('<p>①首次成功订购任意夜间流量包，次月可获赠订购流量包金额50%的话费。</p><p>②赠送的900M本地流量，次月生效，分三个月返还，退订则不再赠送。变更流量包次月生效。</p><p>③使用夜间流量包，必须在夜间23：00：00时断线后再上网，否则之前如已上网未断，将按原定套餐或标资情况收取费用；在次日6：59：59后需下线，否则将按夜间流量包情况收取费用，如果直到用户夜间流量包流量被消耗完毕仍未断线，再回归到用户原有套餐资费或标资收取费用。</p><p>④天翼副号不具备3G上网功能，故天翼副号不参与此活动!</p><p>⑤流量超出后由号码本身套餐或者标准资费来收取。天翼副号不参与此次活动！详询当地10000号。</p>')}
	else if(code.charAt(2)=="4"){if(code.charAt(3)=="3"){$("#warmcontent").html('<p>①新装立即生效，次月自动续包，不能变更，退订次月生效；新装当月套餐月基本费按日计扣（订购当日到月底），首月套餐内包含的500M全国流量按实际使用比例收费； 赠送的4G周日本地流量全额赠送，不可抵扣订购前已使用的上网流量。</p><p>②每月每逢周日可以畅爽使用本地流量，周日使用的流量不算在500M内，当月封顶 4G（一个月一般是4-5个周日，这几个周日使用的流量累计封顶4G）。</p><p>③新用户特权：新用户1-10日成功首次订购任意包月流量包享5折特惠。（具体规则：次月将获赠所订购流量包金额50%的话费，当月拆除次月不送，一个电信手机号码仅限一次，已在电信营业厅客户端、支付宝“中国电信”服务窗等中国电信平台上享受首订5折优惠的用户不重复参与。）</p><p>④赠送的900M本地流量，次月生效，分三个月返还，退订则不再赠送。每个天翼号码只可享受一次赠送优惠。</p><p>⑤天翼副号不具备上网功能，故天翼副号不参与此次活动；</p><p>⑥流量超出后由号码本身套餐或者标准资费来收取。6分卡（0元保底）用户和天翼副号不参与此次活动！详询当地10000号。</p>');}else{$("#warmcontent").html('<p>①订购后立即生效，24小时后失效，不能退订，不能变更，到期自动失效，不自动续包，可以重复订购；生效时间以受理成功时间为准。（例：今天下午4:00订购，4:00受理成功生效，明天下午4:00自动失效。）</p><p>②天翼副号不具备上网功能，故天翼副号不参与此次活动；</p><p>③流量超出后由号码本身套餐或者标准资费来收取。6分卡（0元保底）用户和天翼副号不参与此次活动！详询当地10000号。</p>');}}
	else if(code.charAt(2)=="5"){$("#warmcontent").html('<p>①2016年6月24日起，三日特惠流量包订购当日立即生效，3天*24小时候自动失效，不能退订，不能变更，过期作废，不自动续包；可重复订购，流量不合并，老流量包有效期不变，新流量包有效期按订购时间计算。</p><p>②副卡可单独订购三日特惠流量包，但是不可分享主卡订购的包内业务流量。</p><p>③流量超出后由号码本身套餐或者标准资费来收取。6分卡(0元保底)用户、天翼副号和时长类套餐用户不参与此次活动！详询当地10000号。</p>')}
	else if(code.charAt(2)=="6"){$("#warmcontent").html('<p>①只能开通4G功能的乐享4G套餐用户或开通4G功能的乐享3G套餐用户才能办理。</p><p>②订购立即生效，变更、退订都是次月生效；每个号码限申请一档，不能重复受理。当月资费规则详细如下：订购当月功能费按日计扣（入网当日到月底），费用四舍五入到分；可选包内流量、语音按天这算，流量向上取整到KB，语音向上取整到分钟。</p><p>③副卡不可分享主卡订购的畅聊流量包内业务量（含流量及语音），副卡可单独订购畅聊包，流量仅限省内使用。</p><p>④包内语音时长包含本地主叫（含本地市话和本地国内长途）和国内漫游主叫时长。国内通话免费范围不包括港澳台地区。以下情形不能抵扣包内语音时长；</p><p>⑤拨打800被叫付费电话；</p><p>⑥拨打11808优惠接入码时，按11808资费标准在套外收取；</p><p>⑦流量和语音超出后由号码本身套餐或标准资费来收取。天翼副号、6分卡（0元保底）、上网卡、个人定制及时长型套餐等不能加装流量包套餐的用户不能订购，详询10000号；</p>')}
	unfold();
}	
/*购买页面置顶*/	

/*置顶按钮显示*/
function myscroll(){ 
if($("#flowsbuy").scrollTop()>0)
  {   
	  $("#stick").fadeIn();}
  else{$("#stick").hide();}};
/*流量套餐购买*/	
function tobuy() {
	clickCount(6);
	if($("#checkbox1").is(":checked")){
	$("#content21").hide();
	$("#content22").show();
    window.setTimeout("flowcommit()",2000);}
	}
/*套餐提交*/
function flowcommit(){
	var turl = path1+"xxget.do?command=2&mdn=" + mdn + "&code="+ $("#buycode").val();
	$.ajax( {
		url : turl,
		dataType : "jsonp",
		jsonp : "callback2",
		async : false,
		cache : false,
		success: function(data) {
			if ( data.msg.indexOf("失败")>=0 ){  $("#succimg").html('<img src="images/icon2.png" width="100%" height="100%">');}
				
			}
	});
	
	}	
/*数据查询*/	
function getvv()
{
	/*流量套餐查询*/
	var turl=path+"xxget.do?command=1&mdn="+mdn+"&model=2&pid="+pid;
	$.ajax({
		url:turl,
		dataType:"jsonp",
		jsonp:"callback1",
		async:false,
		cache:false,
		});
	/*话费查询*/	
	var turl=path+"xxget.do?command=0&mdn="+mdn;
	$.ajax({
		url:turl,
		dataType:"jsonp",
		jsonp:"callbackBalance",
		async:false,
		cache:false,
		});
}
		
		
function callbackBalance(jsonStr)
{
	var balance=jsonStr.balance;/*话费余额*/
    $("#huafei").html('<span class="color2 font16">'+balance+'</span>元');	
}
/*流量套餐购买数据回调*/
var tphone,fphone,ayhdlj;	
function callback1(jsonStr){
	 var CurrFlow=jsonStr.CurrFlow;/*已用总流量*/	
	 var RemainFlow=jsonStr.RemainFlow;/*剩余总流量*/
	 var CurrFlow2=jsonStr.CurrFlow2;/*已用总流量*/	
	 var RemainFlow2=jsonStr.RemainFlow2;/*剩余总流量*/	
	 var ratio=jsonStr.ratio/100;
	 var ra=1-ratio;	
	 var ratio2=jsonStr.ratio2/100;
	 var color=jsonStr.color;
	 var ball=jsonStr.ball;
	 var tj1=jsonStr.tj1;/*推荐套餐1*/
	 var tj2=jsonStr.tj2;/*推荐套餐2*/
	 var tj3=jsonStr.tj3;/*推荐套餐3*/
	 var tj4=jsonStr.tj4;/*推荐套餐4*/
	 $("#flownotice").show();
	 var tishiyu=jsonStr.tishiyu;/*小球提示语*/
	 var tyxh=jsonStr.tyxh;
	 var ayhd=jsonStr.ayhd;
	 ayhdlj=jsonStr.ayhdlj;
	 if(tyxh==1){$("#tyxh").show();}
	 if(ayhd==1){$("#ayhd").show();}
	 $("#ayhd a").attr("href",ayhdlj);
	 tphone=jsonStr.phone;
	 fphone=phoneformat(tphone);
	 guoqing=jsonStr.guoqing;/*国庆*/
	 guoqingj(guoqing);
	 recommendmeal(tj1,1);
	 recommendmeal(tj2,2);
	 recommendmeal(tj3,3);
	 recommendmeal(tj4,4); 
	 $("#tishiyu").html(tishiyu);
	 $("#surplus").html('<span class="color2 font16">'+RemainFlow+'</span>M');
	 $("#used").html('<span class="color2 font16">'+CurrFlow+'</span>M');
	 $("#flowball").append('<canvas id="flowball'+ball+'" width="120px" height="120px" class="flowcanvas2" onClick="clickball()"></canvas>');
	 if(ratio==0){ratio=1}else if(ratio==1){ratio=0};
	 drawProcess2(ratio,ra,0);
	 if(ball==0){ drawProcess(ratio,0,RemainFlow2,color);} 
	 var dingxiang=jsonStr.dingxiang;
	 if(dingxiang==1){$("#dingxiangb").show();}
     var BarGroup=jsonStr.BarGroup;
	 var group=jsonStr.Group;
	 var group2=jsonStr.Group2;
/*0:省内、1:国内、2:本地、3:国际、4:其他*/	
	 for( var i=0;i<3;i++)
	 {  var flow_curr=BarGroup[i].flow_curr;
	    var flow_curr2=BarGroup[i].flow_curr2;
		var remain_curr=BarGroup[i].remain_curr;
	    var remain_curr2=BarGroup[i].remain_curr2;
	    var flow_all=BarGroup[i].flow_all;
		var flow_all2=BarGroup[i].flow_all2;
	    var flow_ratio=BarGroup[i].flow_ratio/100;
		var flow_ratio2=BarGroup[i].flow_ratio2/100;
		var flow_ratio3=BarGroup[i].flow_ratio3/100;
		if(flow_ratio==0){flow_ratio=1}else if(flow_ratio==1){flow_ratio=0};
		if(i+1==ball){ drawProcess(flow_ratio,i+1,remain_curr2,color);}
		drawProcess4(flow_ratio2,flow_ratio3,i);
		$("#mymealtext"+i).append('<span class="remain">'+remain_curr+'</span>M/('+flow_all+'+<span style="color:#d77603;">'+flow_all2+'</span>)M'); 
	  } 
	 var str="";  
	 var str2=""; 
	 for(var i=0;i<group.length;i++)
	 {    var groupname=group[i].name;
	      var groupall=group[i].flow_all;
	      var groupvalue=group[i].flow_value;
		  var groupratio=(groupvalue/groupall).toFixed(2);
		  str='<div class="mymealtext1">'+groupname+'</div><div class="mymealtext2"><canvas id="fmeal'+i+'" width="200px" height="20px" class="flowcanvas3"></canvas><br><span class="remain">'+groupvalue+'</span>M/'+groupall+'M</div>'
		$("#mymealbox3").append(str);
	    drawProcess3(groupratio,i);	 
	 };
	 	 for(var i=0;i<group2.length;i++)
	 {    var groupname=group2[i].name;
	      var groupall=group2[i].flow_all;
	      var groupvalue=group2[i].flow_value;
		  var groupratio=(groupvalue/groupall).toFixed(2);
		  str2='<div class="mymealtext1">'+groupname+'</div><div class="mymealtext2"><canvas id="fmeal2'+i+'" width="200px" height="20px" class="flowcanvas3"></canvas><br><span class="remain">'+groupvalue+'</span>M/'+groupall+'M</div>'
		$("#mymealbox2").append(str2);
	    drawProcess5(groupratio,i);
		 
	 };
	 if(group2.length==0){$("#mymealbox2").html("您好，您上月可结转到本月的剩余流量为0。");}
	 };
/*数据回调2*/	 	 
function callback2(jsonStr)
{var msg=jsonStr.msg;
 var code=jsonStr.code;
$("#msg").html(decodeURI(msg));
if(code==1){$("#succimg").html('<img src="'+imgs+'/images/icon2.png" width="100%" height="100%">');}
else if(code==0){$("#succimg").html('<img src="'+imgs+'/images/icon1.png" width="100%" height="100%">');};
$("#msg2").html(decodeURI(msg));
};
/*画流量球*/	
function drawProcess2(p,ra,id) {
	var canvas = document.getElementById("canvas"+id);
	var ctx = canvas.getContext("2d");
	var W = canvas.width;
	var H = canvas.height;
	var deg = 0, new_deg = 0, dif = 0;
	var loop;
	var text, text_w;
	var r_value = 100;
	var color_value;
	var lineCap = 'round';
	function init() {
		ctx.clearRect(0, 0, W, H);
		if (deg < 288) {
			color_value = "#90c41f"
		} else if (deg >= 288&&deg<360) {			 
			color_value = "#fc5d27"
		} else if (deg == 360) {			 
			color_value = "#90c41f"
		} 	
		ctx.beginPath();
		ctx.fillStyle = "#fff";
		ctx.strokeStyle ="#ccc";
		ctx.arc(W / 2, H / 2, r_value, 0, Math.PI * 2, false);
		ctx.closePath();
		ctx.fill();	
		ctx.lineWidth = 10;
		ctx.stroke();
		ctx.moveTo(W / 2, H / 2);	
		var r = deg * Math.PI / 180;
		ctx.beginPath();
		ctx.strokeStyle = color_value;
		ctx.lineWidth = 10;
		ctx.arc(W / 2, H / 2,r_value, r - 90 * Math.PI/ 180, 0 - 90 * Math.PI / 180, false);
		ctx.lineCap =lineCap;
		ctx.stroke();
		ctx.moveTo(W / 2, H / 2);
		switch(id){
			case 0:
				text = "剩余流量";
				break;
			case 1:
				text = "剩余流量";
				break;
			case 2:
				text = "剩余流量";
				break;
		}
		ctx.fillStyle ="#666";
		ctx.font = "20px Microsoft Sans Serif";
		ctx.fillText(text,W / 2 -45, H / 3);	
		ctx.fillStyle = color_value;
		ctx.font = "68px Microsoft Sans Serif";
		if (deg < 0) {
			deg = 0;
		}
		;
		text =Math.ceil(ra*100);
		text_w = ctx.measureText(text).width;
		ctx.fillText(text, W / 2 - text_w / 2-10, H / 2 + 13);
		
		text = "%";
		ctx.fillStyle ="#666";
		ctx.font = "32px Microsoft Sans Serif";
		ctx.fillText(text, W / 2+40, H / 2 + 13);
		
		text = "查看详情";
		ctx.fillStyle ="#2068b8";
		ctx.font = "20px Microsoft Sans Serif";
		ctx.fillText(text,W / 2 -40, H / 2+50);
	}
	function draw() {
		new_deg = Math.round(p * 360);
		dif = new_deg - deg;
		loop = setInterval(to, 1000 / dif)
	}
	function to() {
		if (deg == new_deg) {
			clearInterval(loop);
		}else if (deg < new_deg) {
			deg++
		} else{
			deg--
		}
		init()
	}
	draw();
};
/*画套餐使用情况图*/	
function drawProcess3(p,id){
		var canvas = document.getElementById("fmeal"+id);
		var ctx = canvas.getContext("2d");
		var W = canvas.width;
		var H = canvas.height;
		var hl = 0, new_hl = 0, dif = 0;
		var loop, re_loop;
		var text, text_w;
		function init() {
			ctx.clearRect(0, 0, W, H);
			ctx.beginPath();
			ctx.fillStyle = "#ccc";
			ctx.fillRect(0, 0, 300, 30);
			ctx.fill();
			var r = hl;
			ctx.beginPath();
			ctx.fillStyle = "#90c41f";
			ctx.fillRect(0, 0, r, 30);
			ctx.fill(); 
		}
		function draw() {
			new_hl = Math.round(p * 300);
			dif = new_hl - hl;
			loop = setInterval(to, 1000 / dif)
		}
		function to() {
			if (hl == new_hl) {
				clearInterval(loop)
			}else if (hl < new_hl) {
				hl++
			} else {
				hl--
			}
			init()
		}
		draw();
	
};
function drawProcess5(p,id){
		var canvas = document.getElementById("fmeal2"+id);
		var ctx = canvas.getContext("2d");
		var W = canvas.width;
		var H = canvas.height;
		var hl = 0, new_hl = 0, dif = 0;
		var loop, re_loop;
		var text, text_w;
		function init() {
			ctx.clearRect(0, 0, W, H);
			ctx.beginPath();
			ctx.fillStyle = "#ccc";
			ctx.fillRect(0, 0, 300, 30);
			ctx.fill();
			var r = hl;
			ctx.beginPath();
			ctx.fillStyle = "#90c41f";
			ctx.fillRect(0, 0, r, 30);
			ctx.fill(); 
		}
		function draw() {
			new_hl = Math.round(p * 300);
			dif = new_hl - hl;
			loop = setInterval(to, 1000 / dif)
		}
		function to() {
			if (hl == new_hl) {
				clearInterval(loop)
			}else if (hl < new_hl) {
				hl++
			} else {
				hl--
			}
			init()
		}
		draw();
	
};
function drawProcess4(p,q,id){
		var canvas = document.getElementById("fcanvas"+id);
		var ctx = canvas.getContext("2d");
		var W = canvas.width;
		var H = canvas.height;
		var hl=0,h2=0;
		var loop1,loop2;
		var text, text_w;
		function init() {
			ctx.clearRect(0, 0, W, H);
			ctx.beginPath();
			ctx.fillStyle = "#ccc";
			ctx.fillRect(0, 0, 200, 20);
			ctx.fill();
			var r1 = hl;
			var r2 = h2;
			ctx.beginPath();
			ctx.fillStyle = "#d77603";
			ctx.fillRect(0, 0, r2, 20);
			ctx.fillStyle = "#90c41f";
			ctx.fillRect(0, 0, r1, 20);
			ctx.fill(); 
		}
		function draw() {
			hl = Math.round(p * 200);
			h2 = Math.round(q *200);
            init();
		}
		draw();
	
};

/*画小球流量比例图*/	
function drawProcess(p,id,curr,col) {
	var canvas = document.getElementById("flowball"+id);
	var ctx = canvas.getContext("2d");
	var W = canvas.width;
	var H = canvas.height;
	var deg = 0, new_deg = 0, dif = 0;
	var loop;
	var text, text_w;
	var r_value = 50;
	var color_value;
	function init() {
		ctx.clearRect(0, 0, W, H);
		if (col==0) {
			color_value = "#90c41f"
		} else if (col==1) {			 
			color_value = "#ec9e24"
		} 	
		ctx.beginPath();
		ctx.fillStyle = "#fff";
		ctx.strokeStyle =color_value;
		ctx.arc(W / 2, H / 2, r_value, 0, Math.PI * 2, false);
		ctx.closePath();
		ctx.fill();	
		ctx.lineWidth = 4;
		ctx.stroke();
		ctx.moveTo(W / 2, H / 2);	
		var r = deg * Math.PI / 180;
		ctx.beginPath();
		ctx.strokeStyle = color_value;
		ctx.lineWidth = 10;
		ctx.arc(W / 2, H / 2, r_value-5, r - 90 * Math.PI/ 180, 0 - 90 * Math.PI / 180, false);
		ctx.stroke();
		ctx.moveTo(W / 2, H / 2);
		ctx.fillStyle = color_value;
		ctx.font = "28px Microsoft Sans Serif";
		if (deg < 0) {
			deg = 0;
		}
		;
		text =curr;
		text_w = ctx.measureText(text).width;
		ctx.fillText(text, W / 2 - text_w / 2-2, H / 2 + 11);
		
	}
	function draw() {
		new_deg = Math.round(p * 360);
		dif = new_deg - deg;
		loop = setInterval(to, 1000 / dif)
	}
	function to() {
		if (deg == new_deg) {
			clearInterval(loop)
		}else if (deg <= new_deg) {
			deg++
		} else {
			deg--
		}
		init()
	}
	draw();
};
/*套餐详情展示*/
function meal(p){
	if(p==1){
	clickCount(3);
	$("#flowsmeal1").hide();
	$("#flowsmeal2").show();
	}else if(p==2){
	$("#flowsmeal2").hide();
	$("#flowsmeal1").show();
	$(".contentpage").hide();
	nav(1);
		}
		}
/*关闭推送提交*/
function affirm(p,id){
	var affirm=$("#tt").val();
	var jud=id;	
	if(p==1&&affirm==0){
	$("#affirm").show();
	}else if(p==2){
	$("#affirm").hide();
	}
	if(affirm!=0||(affirm==0&&jud==1))
	{ 
	 $("#affirm").hide();
		$("#sub").show();
	    $("#sub").delay(500).fadeOut();   
	    var turl=path+"xxget.do?command=3&mdn="+encodeURIComponent(mdn)+"&flag="+affirm;
    if(affirm!=3){
	  $.ajax({
		  url:turl,
		  dataType:"jsonp",
		  jsonp: "jsonpCallback",
		  async:false,
		  cache:false,
             })
			 }
			
	}
	}
/*点击事件*/
function clickCount(clickType){
var turl=path+"xxcnt.do?mobileNumber="+mdn+"&clickType="+clickType+"&model="+model+"&pid="+pid;
$.ajax({
	url:turl,
	dataType:"jsonp",
	jsonp:"callback2",
	async:false,
	cache:false
	   })
} 
/*展开提示
function unfold(){	
  var o = document.getElementById("warmcontent");
  var s = o.innerHTML;
  var p = document.createElement("span");
  var n = document.createElement("a");
  p.innerHTML = s.substring(0,20);
   n.style.color="#2068b8";
  n.innerHTML = s.length > 20 ? "...展开" : "";
  n.href = "###";
 
  n.onclick = function(){
    if (n.innerHTML == "...展开"){
      n.innerHTML = "";
      p.innerHTML = s;
    }
  }
  o.innerHTML = "";
  o.appendChild(p);
  o.appendChild(n);}
  */
  
 /*推荐包展示*/
function recommendmeal(code,id){
	var codets=getRecommend(code);
	$('#recommendmeal'+id).append(codets);
		}
		
function getRecommend(code) {
    if (code == "8111") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8111\');"><div class="mealbox"><div class="p1">一次性流量套餐</div><div class="p2">5元买30M</div></div></div>'
    } else if (code == "8112") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8112\');"><div class="mealbox"><div class="p1">一次性流量套餐</div><div class="p2">10元买60M</div></div></div>'
    } else if (code == "8113") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8113\');"><div class="mealbox"><div class="p1">一次性流量套餐</div><div class="p2">20元买150M</div></div></div>'
    } else if (code == "8114") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8114\');"><div class="mealbox"><div class="p1">一次性流量套餐</div><div class="p2">30元买250M</div></div></div>'
    } else if (code == "8115") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8115\');"><div class="mealbox"><div class="p1">一次性流量套餐</div><div class="p2">50元买500M</div></div></div>'
    }else if (code == "8116") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8116\');"><div class="mealbox"><div class="p1">流量加餐特惠包</div><div class="p2">10元买100M</div></div></div>'
    }else if (code == "8117") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8117\');"><div class="mealbox"><div class="p1">流量加餐特惠包</div><div class="p2">30元买500M</div></div></div>'
    }else if (code == "8118") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8118\');"><div class="mealbox"><div class="p1">流量加餐特惠包</div><div class="p2">100元买3G</div></div></div>'
    } else if (code == "8121") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8121\');"><div class="mealbox"><div class="p1">包月流量套餐</div><div class="p2">5元买30M</div></div></div>'
    } else if (code == "8122") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8122\');"><div class="mealbox"><div class="p1">包月流量套餐</div><div class="p2">10元买100M</div></div></div>'
    } else if (code == "8123") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8123\');"><div class="mealbox"><div class="p1">包月流量套餐</div><div class="p2">20元买300M</div></div></div>'
    } else if (code == "8124") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8124\');"><div class="mealbox"><div class="p1">包月流量套餐</div><div class="p2">30元买500M</div></div></div>'
    } else if (code == "8125") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8125\');"><div class="mealbox"><div class="p1">包月流量套餐</div><div class="p2">50元买1G</div></div></div>'
    } else if (code == "8126") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8126\');"><div class="mealbox"><div class="p1">包月流量套餐</div><div class="p2">70元买2G</div></div></div>'
    } else if (code == "8127") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8127\');"><div class="mealbox"><div class="p1">包月流量套餐</div><div class="p2">100元买3G</div></div></div>'
    } else if (code == "8131") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8131\');"><div class="mealbox"><div class="p1">夜间流量套餐</div><div class="p2">10元买1G</div></div></div>'
    } else if (code == "8132") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8132\');"><div class="mealbox"><div class="p1">夜间流量套餐</div><div class="p2">20元买3G</div></div></div>'
    } else if (code == "8141") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8141\');"><div class="mealbox"><div class="p1">包日流量套餐</div><div class="p2">2元买100M</div></div></div>'
    } else if (code == "8142") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8142\');"><div class="mealbox"><div class="p1">包日流量套餐</div><div class="p2">5元买500M</div></div></div>'
    } else if (code == "8143") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8143\');"><div class="mealbox"><div class="p1" style=" height:15px; font-size:0.9em">本地周日畅爽包</div><div class="p2" style=" height:10px; font-size:0.9em">30元买500M</div><div class="p2" style=" height:10px; font-size:0.8em">送周日专属4G本地流量</div></div></div>'
    } else if (code == "8154") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8154\');"><div class="mealbox"><div class="p1">三日特惠流量包</div><div class="p2">10元买1G</div></div></div>'
    }  else if (code == "8161") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8161\');"><div class="mealbox"><div class="p1">4G畅聊流量包</div><div class="p2">10元买100M</div></div></div>'
    } else if (code == "8162") {
        return '<div style="width:100%; height:100%;" onClick="orderbuy(\'8162\');"><div class="mealbox"><div class="p1">4G畅聊流量包</div><div class="p2">50元买1000M</div></div></div>'
    }else if (code == "3333") {
        return '<div style="width:100%; height:100%;" onClick="nav(2);"><div class="mealbox"><div class="p1">一次性流量套餐</div><div class="p2">周三买一送一</div></div></div>'
    } else if (code == "3344") {
        return '<div style="width:100%; height:100%;" onClick="update();"><img class="img_1" data-src="hdbt.png" src="'+imgs+'/images/hdbt.jpg"/></div>'
    } else if (code == "8188") {
        return '<div style="width:100%; height:100%; overflow:hidden;" onClick="update2();"><img data-src="huodong5.jpg" src="'+imgs+'/images/huodong5.jpg" width="100%" height="100%"/></div>'
    } else if (code == "8171") {
        return '<div style="width:100%; height:100%;overflow:hidden;" onClick="update3();"><img data-src="banner.jpg" src="'+imgs+'/images/banner.jpg" width="100%" height="100%"/></div>'
    }else if (code == "2222") {
		return '<div style="width:100%; height:100%;overflow:hidden;" onclick="clickCount(10);"><a    href="http://cservice.client.189.cn:9092/smallNumClient/smallnumber_index.html?shopid=20001"><img data-src="tyxh.jpg" src="'+imgs+'/images/tyxh.jpg" width="100%" height="100%"/></a></div>';
	}
	else if (code == "000000") {
		return '<div style="width:100%; height:100%;overflow:hidden;" onclick="clickCount(10);"><a href="'+ayhdlj+'"><img data-src="ayhd.jpg" src="'+imgs+'/images/ayhd.jpg" width="100%" height="100%"/></a></div>';
	}	
}
 /*周三买一送一显示
function present(){
	var date = new Date();
	if(date.getDay()==3){
	$(".p3b").html("周三买一送一");	
		}
	 }
	 
*/
	 /*办理按钮变化*/ 
	 function change()
{ if(!$("#checkbox1").is(":checked")){ $("#banli").removeClass("solidbtn").addClass("hollowbtn");}else{$("#banli").removeClass("hollowbtn").addClass("solidbtn");}
	
	}
		/*国庆假日包*/
	function update1(){nav(3);$("#content3").hide();$("#guoqing").show();}
	function guoqingj(p){if(p==2||p==0){for(var i=1;i<5;i++){$("#guoq"+i).html('<div> <img src="'+imgs+'/images/guoq'+i+'b.png" width="100%;"/></div>');}}}
	/*3g升级4g*/
	function huodong(){$("#hd1").addClass("hide");$("#hd2").removeClass("hide");}
    function update(){clickCount(100);nav(3);$("#content3").hide();$("#3g").show();}
	/*3g升级4g关闭小球*/
	function pageclose(){$("#p1").hide();}
	/*流量倍增*/
	function update2(){nav(3);$("#content3").hide();$("#beizeng").show();}
	/*3g升4g*/
	function update4(){nav(3);$("#content3").hide();$("#3g4g").show();}
/*小球在线时长心跳包*/
function sendtimecnt(p){var surl=path+"xxh.do?mdn="+mdn+"&type="+p;$.ajax({url:surl,dataType:"jsonp",async:false,cache:false})};

var jus=0;
var chz;
function timedCount(){ 
if(jus!=15){ jus=jus+1;chz=setTimeout("timedCount()",1000);}
 else{$("#flowball" ).addClass("biandan");clearTimeout(chz); jus=0;}}

/*获取活动内容*/

function discovery() {
	var turl=path+"xxfind.do?command=0&pid="+pid;		
	$.ajax( {
		url : turl,
		dataType : "jsonp",
		jsonp : "callbackDisList",
		async : false,
		cache : false
	});
}

function callbackDisList(jsonStr){
	 var array = jsonStr.rows;
	 for(var i=0;i<array.length;i++)
	 {    
          var id=array[i].id;        //ID
	      var shortTitle=array[i].shortTitle;   //短标题
	      var largeIcon=array[i].largeIcon;		//大图标
	      var smallIcon=array[i].smallIcon;		//小图标  
		  if(i==0)
		  { $("#findbox").append('<div class="findboxmax" onClick="activity('+id+');"><img src="'+largeIcon+'"/><div class="findboxmaxword"><p>'+shortTitle+'</p></div></div>');   }else{ $("#findbox").append('<div class="findboxmin" onClick="activity('+id+');"><p>'+shortTitle+'</p><img src="'+smallIcon+'"/></div>');}
	 };
};
function activity(id)
{  nav(3);
   $("#content3").hide();
   $("#content31").show();
	var turl=path+"xxfind.do?command=1&id="+id;	
	$.ajax( {
		url : turl,
		dataType : "jsonp",
		jsonp : "callbackDis",
		async : false,
		cache : false
	});
	}


function callbackDis(jsonStr){
	 var longTitle = jsonStr.longTitle;  //长标题
	 var content = jsonStr.content;  //内容
	 var link = jsonStr.link;  //外部连接
	 var largeIcon = jsonStr.largeIcon;  //大图标
	 $("#findpage1").html(' <div class="activity"> <img src="'+imgs+'/images/logo.png"/></div><p class="longtitle">'+longTitle+'</p> <div class="activityimg" ><img src="'+largeIcon+'"/></div><div class="activitycontent"><p>'+content+'</p></div>');
   if(link!=""){ $("#findpage1").append('<div class="solidbtn3" style="float:left; margin:5px 10% 20px; width:80%; background:#2068b8;" onclick="window.location=\''+link+'\'">活动链接</div>');}
};      

/*1g变10g*/
	function update3(){nav(3);$("#content3").hide();$("#10g").show();}
	function orderbuy2(code){ $("#dingxiang").show();$("#buycode").val(code);if(code=="8172"){$("#dingxiangtext").html("尊敬的用户您将订购“1G优酷定向流量包”是否继续？");}else if(code=="8171"){$("#dingxiangtext").html("尊敬的用户,您将订购“1G腾讯定向流量包”是否继续？");}
	$("#dingxiangtext2").html('<div class="bt2" onClick="tobuy2();">确定</div><div class="bt3" onClick="dxclose();">取消</div><p class="cc"></p>'); }
	function tobuy2(){ 
	$("#dingxiangtext").html('<p id="msg2"></p>');
	$("#dingxiangtext2").html('<div class="bt2" style=" width:80%; margin:0 10%;" onClick="dxclose();">确定</div>><p class="cc"></p>');
	var turl =path+"xxget.do?command=2&mdn=" + mdn + "&code="+ $("#buycode").val();
	$.ajax( {
		url : turl,
		dataType : "jsonp",
		jsonp : "callback2",
		async : false,
		cache : false
	});
	
	}
	function dxclose(){$("#dingxiang").hide();}
	/*11.11活动文字*/
		function huodongdate(){
	var date= new Date();
	if(date.getDay()==13){$("#11title").html("（即日起~2015年12月31日,包月流量送半年）");}
		}
	/*更换图片*/
	 function changeimage(){
			 var cha=$("img");
			 for( var i=0; i<cha.length;i++)
			 {	 var chai=cha[i].getAttribute("data-src");
                 if(chai!=null){
			  chai=imgs+"/images/"+chai;	 			 
              $(cha[i]).attr("src",chai);}
}	  }
    /*终端判断*/
     function iphone(){	      
          var ua = navigator.userAgent.toLowerCase();
		  var isipad=ua.match(/ipad/i)=="ipad"; 
          var isiphone=ua.match(/iphone os/i)=="iphone os"; 
          var ismidp=ua.match(/midp/i)=="midp"; 
          var isuc7=ua.match(/rv:1.2.3.4/i)=="rv:1.2.3.4"; 
          var isuc=ua.match(/ucweb/i)=="ucweb"; 
          var isandroid=ua.match(/android/i)=="android"; 
          var isce=ua.match(/windows ce/i)=="windows ce"; 
          var iswm=ua.match(/windows\s*mobile/i)=="windows mobile";	
		   if(isiphone||isipad)
		{				
		    document.getElementById("iframes").width=document.body.clientWidth;
            document.getElementById("iframes").scrolling = "no";
			}
		  }
		  /*购买二次确认*/	
function twoaffrim() {
	
	if($("#checkbox1").is(":checked")&&sucph==0){
		$("#twoaffirm").show();	
		$("#fphone").text(fphone);
		//$("input[type=tel]").eq(0).focus();	
		}else{tobuy();}
	}		  
function affrimclose() {
	$("#phonefour").val("");
	$("#twoaffirm").hide();
	
	}  
function phoneformat(phone){	
	var str=[],ph=phone;
	for(var i=0;i<ph.length;i++)
	{  if(i>2&&i<7)
	   {str+='*';
	   continue;
	   }
	   str+=ph[i];
	  
		}
		 return str;
	}
var sucph=0,novph=3;
function phoneverify(){
	var phonefour=$("#phonefour").val();
	var str=tphone.substring(3,7);
	if(phonefour==str&&phonefour!="")
	{tobuy();
	  sucph=1;
	  affrimclose();
	}
	else if(phonefour=="")
	{ $("#verify").show().text("内容不能为空!").delay(2000).fadeOut();	
	}
	else if(phonefour!=str&&novph!=1)
	{ $("#phonefour").val(""); 
	  novph--; 
	$("#verify").show().text('号码填写错误!(还有'+novph+'次机会)').delay(2000).fadeOut();
		
	}else if(phonefour!=str&&novph==1)
	 {
		 $("#pagepush").hide();}
	}
function phoneblur(){
	var phone=$("#phonefour").val();
	var len=phone.length;	
	if(len==4){$("#phonefour").blur();}

	}

